﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace lcmyjobs.DAL
{
	/// <summary>
	/// 数据访问类:enterprise_basic
	/// </summary>
	public partial class enterprise_basic
	{
		public enterprise_basic()
		{}
        /// <summary>
        /// 使浏览次数+1
        /// </summary>
        /// <param name="enterprise_bid"></param>
        /// <returns></returns>
        public bool UpdateBcount(int enterprise_bid)
        {
            int rowsAffected = 0;
            SqlParameter[] para = 
            {
                new SqlParameter("@enterprise_bid",SqlDbType.Int)
            };

            para[0].Value = enterprise_bid;

             DbHelperSQL.RunProcedure("P_Update_enterprise_baisc_bcount", para,out rowsAffected);

             if (rowsAffected > 0)
             {
                 return true;
             }
             else
             {
                 return false;
             }
        }
        /// <summary>
        /// 升级会员
        /// </summary>
        /// <param name="enterprise_bid">单位编号</param>
        /// <param name="enterprise_mid">会员类型主键</param>
        /// <param name="membertime">会员到期时间</param>
        /// <returns></returns>
        public int UpdateMemberLevel(int enterprise_bid, int enterprise_mid, DateTime membertime)
        {
            string sql = " update enterprise_basic set status=1,enterprise_mid = "+enterprise_mid+",membertime='"+membertime+"' where enterprise_bid="+enterprise_bid;

            return DbHelperSQL.ExecuteSql(sql);
        }
        /// <summary>
        /// 获取单位管理中心首页统计数字
        /// </summary>
        /// <param name="enterprise_bid"></param>
        /// <returns></returns>
        public DataSet GetIndexInfo(int enterprise_bid)
        {
            SqlParameter[] para = 
            {
                new SqlParameter("@enterprise_bid",SqlDbType.Int)
            };

            para[0].Value = enterprise_bid;

            return DbHelperSQL.RunProcedure("P_Get_enterpriseIndexInfo", para, "ds");
        }
        /// <summary>
        /// 获取单位信息及单位所发布的所有职位信息
        /// </summary>
        /// <param name="enterprise_bid"></param>
        /// <returns>表一、单位基本信息，表二、单位所属行业，表三、单位发布职位信息</returns>
        public DataSet GetReleaseJobByBid(int enterprise_bid)
        {
            SqlParameter[] para = 
            {
                new SqlParameter("@enterprise_bid",SqlDbType.Int)
            };

            para[0].Value = enterprise_bid;

            return DbHelperSQL.RunProcedure("P_Get_releasejobs_by_enterpirse_bid", para, "ds");
        }
        /// <summary>
        /// 获取全部单位审核信息
        /// </summary>
        /// <returns></returns>
        public DataSet GetCheckInfo(int atid, int currentPageIndex, int pageSize, out int count)
        { 
            SqlParameter [] para = 
            {
                new SqlParameter("@atid",SqlDbType.Int),
                new SqlParameter("@currentPageIndex",SqlDbType.Int),
                new SqlParameter("@pageSize",SqlDbType.Int),
                new SqlParameter("@count",SqlDbType.Int)
            };

            para[0].Value = atid;
            para[1].Value = currentPageIndex;
            para[2].Value = pageSize;
            para[3].Direction = ParameterDirection.Output;

           
            DataSet ds =  DbHelperSQL.RunProcedure("P_Get_EnterpriseCheckInfo", para, "ds");

            count = Convert.ToInt32(para[3].Value);

            return ds;
        }
        /// <summary>
        /// 检查用户名和密码
        /// </summary>
        /// <param name="login"></param>
        /// <param name="pwd"></param>
        /// <returns>返回enterprise_bid</returns>
        public DataSet  Check_login(string login, string pwd,out int enterprise_bid)
        {
            //int result = -1;
            SqlParameter[] para = { new SqlParameter("@login",SqlDbType.VarChar,10),
                                    new SqlParameter("@pwd",SqlDbType.VarChar,20),
                                    new SqlParameter("@enterprise_bid",SqlDbType.Int)};

            para[0].Value = login;
            para[1].Value = pwd;
            para[2].Direction = ParameterDirection.Output; 

            DataSet ds  = DbHelperSQL.RunProcedure("P_Chenck_enterprise_login", para,"ds");

            if (!Convert.IsDBNull(para[2].Value))
            {
                enterprise_bid = Convert.ToInt32(para[2].Value);
            }
            else
            {
                enterprise_bid = 0;
            }
           
            return ds;
        }
        /// <summary>
        /// 获取企业基本信息，返回值dataset中的表0为basic信息，表1为trade信息
        /// </summary>
        /// <param name="enterprise_bid"></param>
        /// <returns></returns>
        public DataSet Get_enterprise_basic(int enterprise_bid)
        {
            SqlParameter[] para = { new SqlParameter("@enterprise_bid",SqlDbType.Int,4)};
            para[0].Value = enterprise_bid;

            return DbHelperSQL.RunProcedure("P_Get_enterprise_basic",para,"ds");
        }

		#region  Method

		/// <summary>
		/// 得到最大ID
		/// </summary>
		public int GetMaxId()
		{
		return DbHelperSQL.GetMaxID("enterprise_bid", "enterprise_basic"); 
		}

	
        /// <summary>
        /// 检查名称
        /// </summary>
        /// <param name="name">被检查名称</param>
        /// <param name="type">1、检查用户名，2、检查Email</param>
        /// <returns></returns>
		public bool Exists(string name,string type)
		{
            SqlParameter parameters = null;
            object result = null;

            if (type == "1")//检查用户名
            {
                parameters = new SqlParameter("@login", SqlDbType.VarChar, 10);
                parameters.Value = name;

                result = DbHelperSQL.GetSingle(" select count(*) from enterprise_basic where login=@login ", parameters);
              
            }

            if (type == "2")//检查Email
            {
                parameters = new SqlParameter("@email", SqlDbType.VarChar, 30);
                parameters.Value = name;

                result = DbHelperSQL.GetSingle(" select count(*) from enterprise_basic where email=@email ", parameters);
              
            }

            if (result != null)
            {
                if (result.ToString() != "0")
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
                
		}

       /// <summary>
       /// 更改时检查名称
       /// </summary>
       /// <param name="name">被检查的名称</param>
       /// <param name="enterprise_bid">编号ＩＤ（主键）</param>
        /// <param name="type">类型：1、检查用户名，2、检查Email</param>
       /// <returns></returns>
        public bool Exists(string name, string enterprise_bid,string type )
        {
            SqlParameter parameters = null;
            object result = null;

            if (type == "1")//检查用户名
            {
                parameters = new SqlParameter("@login", SqlDbType.VarChar, 10);
                parameters.Value = name;

                result = DbHelperSQL.GetSingle(" select count(*) from enterprise_basic where login=@login　and enterprise_bid <> "+enterprise_bid, parameters);

            }

            if (type == "2")//检查Email
            {
                parameters = new SqlParameter("@email", SqlDbType.VarChar, 30);
                parameters.Value = name;

                result = DbHelperSQL.GetSingle(" select count(*) from enterprise_basic where email=@email and enterprise_bid <> "+enterprise_bid , parameters);

            }

            if (result != null)
            {
                if (result.ToString() != "0")
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }

        }

		/// <summary>
		///  增加一条数据
		/// </summary>
		public int Add(lcmyjobs.Model.enterprise_basic model)
		{
			int rowsAffected;
			SqlParameter[] parameters = {
					new SqlParameter("@enterprise_bid", SqlDbType.Int,4),
					new SqlParameter("@enterprise_bh", SqlDbType.Char,5),
					new SqlParameter("@login", SqlDbType.VarChar,20),
					new SqlParameter("@pwd", SqlDbType.VarChar,20),
					new SqlParameter("@name", SqlDbType.NVarChar,30),
					new SqlParameter("@area_name", SqlDbType.NVarChar,20),
					new SqlParameter("@dwxz", SqlDbType.NVarChar,5),
					new SqlParameter("@dwgm", SqlDbType.NVarChar,13),
					new SqlParameter("@clnf", SqlDbType.Char,4),
					new SqlParameter("@lxr", SqlDbType.NVarChar,6),
					new SqlParameter("@telephone", SqlDbType.VarChar,14),
					new SqlParameter("@email", SqlDbType.VarChar,30),
					new SqlParameter("@fax", SqlDbType.VarChar,14),
					new SqlParameter("@mobilephone", SqlDbType.Char,11),
					new SqlParameter("@website", SqlDbType.VarChar,40),
					new SqlParameter("@place", SqlDbType.VarChar,60),
					new SqlParameter("@address", SqlDbType.VarChar,60),
					new SqlParameter("@interviewadd", SqlDbType.VarChar,60),
					new SqlParameter("@about", SqlDbType.Text),
					new SqlParameter("@isemp", SqlDbType.Bit,1),
					new SqlParameter("@ispub", SqlDbType.Bit,1),
					new SqlParameter("@lastlogin", SqlDbType.DateTime),
					new SqlParameter("@logincount", SqlDbType.SmallInt,2),
					new SqlParameter("@isshowlink", SqlDbType.VarChar,40),
					new SqlParameter("@enterprise_mid", SqlDbType.Int,4),
					new SqlParameter("@bcount", SqlDbType.Int,4),
					new SqlParameter("@membertime", SqlDbType.DateTime),
					new SqlParameter("@issubsrciption", SqlDbType.Bit,1),
					new SqlParameter("@status", SqlDbType.TinyInt,1),
                    new SqlParameter("@tradename1",SqlDbType.NVarChar,20),
                    new SqlParameter("@tradename2",SqlDbType.NVarChar,20),
                    new SqlParameter("@tradename3",SqlDbType.NVarChar,20),
                    new SqlParameter("@atid",SqlDbType.Int)};
			parameters[0].Direction = ParameterDirection.Output;
			parameters[1].Value = model.enterprise_bh;
			parameters[2].Value = model.login;
			parameters[3].Value = model.pwd;
			parameters[4].Value = model.name;
			parameters[5].Value = model.areaname;
			parameters[6].Value = model.dwxz;
			parameters[7].Value = model.dwgm;
			parameters[8].Value = model.clnf;
			parameters[9].Value = model.lxr;
			parameters[10].Value = model.telephone;
			parameters[11].Value = model.email;
			parameters[12].Value = model.fax;
			parameters[13].Value = model.mobilephone;
			parameters[14].Value = model.website;
			parameters[15].Value = model.place;
			parameters[16].Value = model.address;
			parameters[17].Value = model.interviewadd;
			parameters[18].Value = model.about;
			parameters[19].Value = model.isemp;
			parameters[20].Value = model.ispub;
			parameters[21].Value = model.lastlogin;
			parameters[22].Value = model.logincount;
			parameters[23].Value = model.isshowlink;
			parameters[24].Value = model.enterprise_mid;
			parameters[25].Value = model.bcount;
			parameters[26].Value = model.membertime;
			parameters[27].Value = model.issubsrciption;
			parameters[28].Value = model.status;
            parameters[29].Value = model.tradename1;
            parameters[30].Value = model.tradename2;
            parameters[31].Value = model.tradename3;
            parameters[32].Value = model.atid;
                
            DbHelperSQL.RunProcedure("P_Add_enterprise_basic", parameters, out rowsAffected);
			return (int)parameters[0].Value;
		}

		/// <summary>
		///  更新一条数据(更改基本信息)
		/// </summary>
		public bool Update(lcmyjobs.Model.enterprise_basic model)
		{
			int rowsAffected=0;
			SqlParameter[] parameters = {
					new SqlParameter("@enterprise_bid", SqlDbType.Int,4),
					//new SqlParameter("@enterprise_bh", SqlDbType.Char,5),
					//new SqlParameter("@login", SqlDbType.VarChar,20),
					//new SqlParameter("@pwd", SqlDbType.VarChar,20),
					new SqlParameter("@name", SqlDbType.NVarChar,30),
					new SqlParameter("@area_name", SqlDbType.NVarChar,20),
					new SqlParameter("@dwxz", SqlDbType.NVarChar,5),
					new SqlParameter("@dwgm", SqlDbType.NVarChar,13),
					new SqlParameter("@clnf", SqlDbType.Char,4),
					new SqlParameter("@lxr", SqlDbType.NVarChar,6),
					new SqlParameter("@telephone", SqlDbType.VarChar,14),
					new SqlParameter("@email", SqlDbType.VarChar,30),
					new SqlParameter("@fax", SqlDbType.VarChar,14),
					new SqlParameter("@mobilephone", SqlDbType.Char,11),
					new SqlParameter("@website", SqlDbType.VarChar,40),
					new SqlParameter("@place", SqlDbType.VarChar,60),
					new SqlParameter("@address", SqlDbType.VarChar,60),
					new SqlParameter("@interviewadd", SqlDbType.VarChar,60),
					new SqlParameter("@about", SqlDbType.Text),
                    new SqlParameter("@tradename1",SqlDbType.NVarChar,20),
                    new SqlParameter("@tradename2",SqlDbType.NVarChar,20),
                    new SqlParameter("@tradename3",SqlDbType.NVarChar,20),
                    new SqlParameter("@atid",SqlDbType.Int)};
                    //new SqlParameter("@isemp", SqlDbType.Bit,1),
                    //new SqlParameter("@ispub", SqlDbType.Bit,1),
                    //new SqlParameter("@lastlogin", SqlDbType.DateTime),
                    //new SqlParameter("@logincount", SqlDbType.SmallInt,2),
                    //new SqlParameter("@isshowlink", SqlDbType.VarChar,40),
                    //new SqlParameter("@enterprise_mid", SqlDbType.Int,4),
                    //new SqlParameter("@bcount", SqlDbType.Int,4),
                    //new SqlParameter("@membertime", SqlDbType.DateTime),
                    //new SqlParameter("@issubsrciption", SqlDbType.Bit,1),
                    //new SqlParameter("@status", SqlDbType.TinyInt,1)};
			parameters[0].Value = model.enterprise_bid;
            //parameters[1].Value = model.enterprise_bh;
            //parameters[2].Value = model.login;
            //parameters[3].Value = model.pwd;
			parameters[1].Value = model.name;
			parameters[2].Value = model.areaname;
			parameters[3].Value = model.dwxz;
			parameters[4].Value = model.dwgm;
			parameters[5].Value = model.clnf;
			parameters[6].Value = model.lxr;
			parameters[7].Value = model.telephone;
			parameters[8].Value = model.email;
			parameters[9].Value = model.fax;
			parameters[10].Value = model.mobilephone;
			parameters[11].Value = model.website;
			parameters[12].Value = model.place;
			parameters[13].Value = model.address;
			parameters[14].Value = model.interviewadd;
			parameters[15].Value = model.about;
            parameters[16].Value = model.tradename1;
            parameters[17].Value = model.tradename2;
            parameters[18].Value = model.tradename3;
            parameters[19].Value = model.atid;
            //parameters[19].Value = model.isemp;
            //parameters[20].Value = model.ispub;
            //parameters[21].Value = model.lastlogin;
            //parameters[22].Value = model.logincount;
            //parameters[23].Value = model.isshowlink;
            //parameters[24].Value = model.enterprise_mid;
            //parameters[25].Value = model.bcount;
            //parameters[26].Value = model.membertime;
            //parameters[27].Value = model.issubsrciption;
            //parameters[28].Value = model.status;

            DbHelperSQL.RunProcedure("P_Update_enterprise_basic", parameters, out rowsAffected);
			if (rowsAffected > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
        /// <summary>
		///  更新一条数据(更改是否公开联系方式)
		/// </summary>
        public bool UpdateIspub(lcmyjobs.Model.enterprise_basic model)
        {
            int rowsAffected=0;
            SqlParameter[] parameters = { new SqlParameter("@enterprise_bid",SqlDbType.Int),
                                          new SqlParameter("@ispub",SqlDbType.Bit)};

            parameters[0].Value = model.enterprise_bid;
            parameters[1].Value = model.ispub;

            DbHelperSQL.RunProcedure("P_Update_enterprise_basic_ispub", parameters, out rowsAffected);
            if (rowsAffected > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        ///  更新一条数据(更改是否招聘中)
        /// </summary>
        public bool UpdateIsemp(lcmyjobs.Model.enterprise_basic model)
        {
            int rowsAffected = 0;
            SqlParameter[] parameters = { new SqlParameter("@enterprise_bid",SqlDbType.Int),
                                          new SqlParameter("@isemp",SqlDbType.Bit)};

            parameters[0].Value = model.enterprise_bid;
            parameters[1].Value = model.isemp;

            DbHelperSQL.RunProcedure("P_Update_enterprise_basic_isemp", parameters, out rowsAffected);
            if (rowsAffected > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        ///  更新密码(更改是否招聘中)
        /// </summary>
        public bool UpdatePwd(int bid,string pwd)
        {
            int rowsAffected;
            SqlParameter[] parameters = { new SqlParameter("@enterprise_bid",SqlDbType.Int),
                                          new SqlParameter("@pwd",SqlDbType.VarChar,20)};

            parameters[0].Value = bid;
            parameters[1].Value = pwd;

            rowsAffected = DbHelperSQL.ExecuteSql(" Update enterprise_basic Set pwd=@pwd Where enterprise_bid=@enterprise_bid ", parameters);
            if (rowsAffected > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 通过email取得ID
        /// </summary>
        public DataSet FindIDByEmail(string email)
        {
            return DbHelperSQL.Query("select enterprise_bid,name,resetpwdtime from enterprise_basic where email= '" + email + "'");
        }
        public int setResetPWDTime(string uid, string resetpwdtime)
        {
            return DbHelperSQL.ExecuteSql("update enterprise_basic set resetpwdtime=" + resetpwdtime + " from enterprise_basic where enterprise_bid=" + uid);
        }
        public DataSet getResetPWDTime(string uid)
        {
            return DbHelperSQL.Query("select resetpwdtime,pwd from enterprise_basic where enterprise_bid=" + uid);
        }

        /// <summary>
        /// 批量更改
        /// </summary>
        /// <param name="keywords">更改字段名</param>
        /// <param name="idlists">更改的ID列表</param>
        /// <param name="value">更改值</param>
        /// <returns></returns>
        public bool UpdateIDList(string keywords,string idlists,string value)
        {
            string str = " Update enterprise_basic set "+keywords+"='"+value+"' where enterprise_bid in ("+idlists+") ";

            int result = DbHelperSQL.ExecuteSql(str);

            if (result > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(int enterprise_bid)
		{
			int rowsAffected=0;
			SqlParameter[] parameters = {
					new SqlParameter("@enterprise_bid", SqlDbType.Int,4)
};
			parameters[0].Value = enterprise_bid;

            DbHelperSQL.RunProcedure("P_Delete_enterprise_basic", parameters, out rowsAffected);
			if (rowsAffected > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

     
		/// <summary>
		/// 批量删除数据
		/// </summary>
		public bool DeleteList(string enterprise_bidlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from enterprise_basic ");
			strSql.Append(" where enterprise_bid in ("+enterprise_bidlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public lcmyjobs.Model.enterprise_basic GetModel(int enterprise_bid)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@enterprise_bid", SqlDbType.Int,4)
};
			parameters[0].Value = enterprise_bid;

			lcmyjobs.Model.enterprise_basic model=new lcmyjobs.Model.enterprise_basic();
            DataSet ds = DbHelperSQL.RunProcedure("P_Get_enterprise_basic", parameters, "ds");
			if(ds.Tables[0].Rows.Count>0)
			{
				if(ds.Tables[0].Rows[0]["enterprise_bid"]!=null && ds.Tables[0].Rows[0]["enterprise_bid"].ToString()!="")
				{
					model.enterprise_bid=int.Parse(ds.Tables[0].Rows[0]["enterprise_bid"].ToString());
				}
				if(ds.Tables[0].Rows[0]["enterprise_bh"]!=null && ds.Tables[0].Rows[0]["enterprise_bh"].ToString()!="")
				{
					model.enterprise_bh=ds.Tables[0].Rows[0]["enterprise_bh"].ToString();
				}
				if(ds.Tables[0].Rows[0]["login"]!=null && ds.Tables[0].Rows[0]["login"].ToString()!="")
				{
					model.login=ds.Tables[0].Rows[0]["login"].ToString();
				}
				if(ds.Tables[0].Rows[0]["pwd"]!=null && ds.Tables[0].Rows[0]["pwd"].ToString()!="")
				{
					model.pwd=ds.Tables[0].Rows[0]["pwd"].ToString();
				}
				if(ds.Tables[0].Rows[0]["name"]!=null && ds.Tables[0].Rows[0]["name"].ToString()!="")
				{
					model.name=ds.Tables[0].Rows[0]["name"].ToString();
				}
                if (ds.Tables[0].Rows[0]["areas_id"] != null && ds.Tables[0].Rows[0]["areas_id"].ToString() != "")
                {
                    model.areas_id = int.Parse(ds.Tables[0].Rows[0]["areas_id"].ToString());
                }
				if(ds.Tables[0].Rows[0]["dwxz"]!=null && ds.Tables[0].Rows[0]["dwxz"].ToString()!="")
				{
					model.dwxz=ds.Tables[0].Rows[0]["dwxz"].ToString();
				}
				if(ds.Tables[0].Rows[0]["dwgm"]!=null && ds.Tables[0].Rows[0]["dwgm"].ToString()!="")
				{
					model.dwgm=ds.Tables[0].Rows[0]["dwgm"].ToString();
				}
				if(ds.Tables[0].Rows[0]["clnf"]!=null && ds.Tables[0].Rows[0]["clnf"].ToString()!="")
				{
					model.clnf=ds.Tables[0].Rows[0]["clnf"].ToString();
				}
				if(ds.Tables[0].Rows[0]["lxr"]!=null && ds.Tables[0].Rows[0]["lxr"].ToString()!="")
				{
					model.lxr=ds.Tables[0].Rows[0]["lxr"].ToString();
				}
				if(ds.Tables[0].Rows[0]["telephone"]!=null && ds.Tables[0].Rows[0]["telephone"].ToString()!="")
				{
					model.telephone=ds.Tables[0].Rows[0]["telephone"].ToString();
				}
				if(ds.Tables[0].Rows[0]["email"]!=null && ds.Tables[0].Rows[0]["email"].ToString()!="")
				{
					model.email=ds.Tables[0].Rows[0]["email"].ToString();
				}
				if(ds.Tables[0].Rows[0]["fax"]!=null && ds.Tables[0].Rows[0]["fax"].ToString()!="")
				{
					model.fax=ds.Tables[0].Rows[0]["fax"].ToString();
				}
				if(ds.Tables[0].Rows[0]["mobilephone"]!=null && ds.Tables[0].Rows[0]["mobilephone"].ToString()!="")
				{
					model.mobilephone=ds.Tables[0].Rows[0]["mobilephone"].ToString();
				}
				if(ds.Tables[0].Rows[0]["website"]!=null && ds.Tables[0].Rows[0]["website"].ToString()!="")
				{
					model.website=ds.Tables[0].Rows[0]["website"].ToString();
				}
				if(ds.Tables[0].Rows[0]["place"]!=null && ds.Tables[0].Rows[0]["place"].ToString()!="")
				{
					model.place=ds.Tables[0].Rows[0]["place"].ToString();
				}
				if(ds.Tables[0].Rows[0]["address"]!=null && ds.Tables[0].Rows[0]["address"].ToString()!="")
				{
					model.address=ds.Tables[0].Rows[0]["address"].ToString();
				}
				if(ds.Tables[0].Rows[0]["interviewadd"]!=null && ds.Tables[0].Rows[0]["interviewadd"].ToString()!="")
				{
					model.interviewadd=ds.Tables[0].Rows[0]["interviewadd"].ToString();
				}
				if(ds.Tables[0].Rows[0]["about"]!=null && ds.Tables[0].Rows[0]["about"].ToString()!="")
				{
					model.about=ds.Tables[0].Rows[0]["about"].ToString();
				}
				if(ds.Tables[0].Rows[0]["isemp"]!=null && ds.Tables[0].Rows[0]["isemp"].ToString()!="")
				{
					if((ds.Tables[0].Rows[0]["isemp"].ToString()=="1")||(ds.Tables[0].Rows[0]["isemp"].ToString().ToLower()=="true"))
					{
						model.isemp=true;
					}
					else
					{
						model.isemp=false;
					}
				}
				if(ds.Tables[0].Rows[0]["ispub"]!=null && ds.Tables[0].Rows[0]["ispub"].ToString()!="")
				{
					if((ds.Tables[0].Rows[0]["ispub"].ToString()=="1")||(ds.Tables[0].Rows[0]["ispub"].ToString().ToLower()=="true"))
					{
						model.ispub=true;
					}
					else
					{
						model.ispub=false;
					}
				}
				if(ds.Tables[0].Rows[0]["lastlogin"]!=null && ds.Tables[0].Rows[0]["lastlogin"].ToString()!="")
				{
					model.lastlogin=DateTime.Parse(ds.Tables[0].Rows[0]["lastlogin"].ToString());
				}
				if(ds.Tables[0].Rows[0]["logincount"]!=null && ds.Tables[0].Rows[0]["logincount"].ToString()!="")
				{
					model.logincount=int.Parse(ds.Tables[0].Rows[0]["logincount"].ToString());
				}
				if(ds.Tables[0].Rows[0]["isshowlink"]!=null && ds.Tables[0].Rows[0]["isshowlink"].ToString()!="")
				{
					model.isshowlink=ds.Tables[0].Rows[0]["isshowlink"].ToString();
				}
				if(ds.Tables[0].Rows[0]["enterprise_mid"]!=null && ds.Tables[0].Rows[0]["enterprise_mid"].ToString()!="")
				{
					model.enterprise_mid=int.Parse(ds.Tables[0].Rows[0]["enterprise_mid"].ToString());
				}
				if(ds.Tables[0].Rows[0]["bcount"]!=null && ds.Tables[0].Rows[0]["bcount"].ToString()!="")
				{
					model.bcount=int.Parse(ds.Tables[0].Rows[0]["bcount"].ToString());
				}
				if(ds.Tables[0].Rows[0]["membertime"]!=null && ds.Tables[0].Rows[0]["membertime"].ToString()!="")
				{
					model.membertime=DateTime.Parse(ds.Tables[0].Rows[0]["membertime"].ToString());
				}
				if(ds.Tables[0].Rows[0]["issubsrciption"]!=null && ds.Tables[0].Rows[0]["issubsrciption"].ToString()!="")
				{
					if((ds.Tables[0].Rows[0]["issubsrciption"].ToString()=="1")||(ds.Tables[0].Rows[0]["issubsrciption"].ToString().ToLower()=="true"))
					{
						model.issubsrciption=true;
					}
					else
					{
						model.issubsrciption=false;
					}
				}
				if(ds.Tables[0].Rows[0]["status"]!=null && ds.Tables[0].Rows[0]["status"].ToString()!="")
				{
					model.status=int.Parse(ds.Tables[0].Rows[0]["status"].ToString());
				}
				return model;
			}
			else
			{
				return null;
			}
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select enterprise_bid,enterprise_bh,login,pwd,name,areas_id,dwxz,dwgm,clnf,lxr,telephone,email,fax,mobilephone,website,place,address,interviewadd,about,isemp,ispub,lastlogin,logincount,isshowlink,enterprise_mid,bcount,membertime,issubsrciption,status ");
			strSql.Append(" FROM enterprise_basic ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" enterprise_bid,enterprise_bh,login,pwd,name,areas_id,dwxz,dwgm,clnf,lxr,telephone,email,fax,mobilephone,website,place,address,interviewadd,about,isemp,ispub,lastlogin,logincount,isshowlink,enterprise_mid,bcount,membertime,issubsrciption,status ");
			strSql.Append(" FROM enterprise_basic ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "enterprise_basic";
			parameters[1].Value = "enterprise_bid";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/

		#endregion  Method
	}
}

